package com.cs.bd.notification.api;

import android.support.annotation.Nullable;
import android.text.TextUtils;

public class NotificationSdkParams {

    private long mInstallTimeMillis;
    private String mBuyChannel;
    private int mUserFrom;
    private boolean mIsUpgradeUser;
    private String mChannel;
    private String mEntranceId;
    private String mYahooAppKey;

    private NotificationSdkParams() {
    }

    public long getInstallTimeMillis() {
        return this.mInstallTimeMillis;
    }

    public String getBuyChannel() {
        return this.mBuyChannel;
    }

    public int getUserFrom() {
        return this.mUserFrom;
    }

    public boolean isIsUpgradeUser() {
        return this.mIsUpgradeUser;
    }

    public String getChannel() {
        return this.mChannel;
    }

    public String getYahooAppKey() {
        return this.mYahooAppKey;
    }

    public String getEntranceId() {
        return this.mEntranceId;
    }

    public static class NotificationSdkParamsBuilder {
        private long mInstallTimeMillis;
        private String mBuyChannel;
        private int mUserFrom = -2147483648;
        private boolean mIsUpgradeUser;
        private String mChannel;
        private String mEntranceId;
        private String mYahooAppKey;

        public NotificationSdkParamsBuilder() {
        }

        public NotificationSdkParams.NotificationSdkParamsBuilder installTimeMillis(long installTimeMillis) {
            this.mInstallTimeMillis = installTimeMillis;
            return this;
        }

        public NotificationSdkParams.NotificationSdkParamsBuilder buyChannel(String buyChannel) {
            this.mBuyChannel = buyChannel;
            return this;
        }

        public NotificationSdkParams.NotificationSdkParamsBuilder userFrom(int userFrom) {
            this.mUserFrom = userFrom;
            return this;
        }

        public NotificationSdkParams.NotificationSdkParamsBuilder isUpgradeUser(boolean isUpgradeUser) {
            this.mIsUpgradeUser = isUpgradeUser;
            return this;
        }

        public NotificationSdkParams.NotificationSdkParamsBuilder channel(String channel) {
            this.mChannel = channel;
            return this;
        }

        @Nullable
        public NotificationSdkParams.NotificationSdkParamsBuilder entranceId(String entranceId) {
            this.mEntranceId = entranceId;
            return this;
        }

        public NotificationSdkParams.NotificationSdkParamsBuilder yahooAppKey(String yahooAppKey) {
            this.mYahooAppKey = yahooAppKey;
            return this;
        }

        public NotificationSdkParams build() {
            NotificationSdkParams params = new NotificationSdkParams();
            params.mInstallTimeMillis = this.mInstallTimeMillis;
            params.mBuyChannel = TextUtils.isEmpty(this.mBuyChannel) ? this.mBuyChannel : this.mBuyChannel.toLowerCase();
            params.mUserFrom = this.mUserFrom;
            params.mIsUpgradeUser = this.mIsUpgradeUser;
            params.mChannel = this.mChannel;
            params.mEntranceId = this.mEntranceId;
            params.mYahooAppKey = this.mYahooAppKey;
            return params;
        }
    }
}
